import { adminBaseRoutePath } from '/@/router/static/adminBase'
import createAxios from '/@/utils/axios'

const goodsUrl = adminBaseRoutePath + '/shop.goods.goods/'
const classifyUrl = adminBaseRoutePath + '/shop.goods.classify/'
const specTemplateUrl = adminBaseRoutePath + '/shop.goods.specTemplate/'
const paramsTemplateUrl = adminBaseRoutePath + '/shop.goods.paramsTemplate/'
const deliveryTemplateUrl = adminBaseRoutePath + '/shop.delivery.template/'

//获取规格模板
export function getSpecTemplate() {
    return createAxios({
        url: specTemplateUrl + 'template',
        method: 'get',
    })
}
//修改库存
export function editStockData(params: anyObj) {
    return createAxios(
        {
            url: goodsUrl + 'editStock',
            method: 'POST',
            params: params,
        },
        {
            showSuccessMessage: true,
        }
    )
}
//获取参数模板
export function getParamsTemplate() {
    return createAxios({
        url: paramsTemplateUrl + 'template',
        method: 'get',
    })
}
//获取物流模板
export function getDeliveryTemplate() {
    return createAxios({
        url: deliveryTemplateUrl + 'index',
        method: 'get',
    })
}
//获取商品分类
export const getClassify = () => {
    return createAxios({
        url: classifyUrl + 'classify',
        method: 'get',
    })
}
